﻿#ifndef _PROP_H_
#define _PROP_H_
#include "ui/CocosGUI.h"
#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
//强化射速 强化火力 弱化病毒 呼叫支援 点石成金 击退射击 活化病毒 巨化病毒 限制移动
enum PropType{ EnhancedRateOfFire = 1, EnhancedFirepower, WeakenedVirus, CallSupport, PerformWonders,
	RepulsiveShooting, ChallengeVirus, MegaloVirus, RestrictMovement};
class Prop : public cocos2d::ui::Widget{
public:
	Prop(PropType type);
	static Prop* create(PropType type);
	bool init();
	void initCSBFile();
	void initSpriteFrameCache();
	void update(float dt);
	void blinkUpdate(float dt);
	void setPropInitPos(cocos2d::Vec2 pos) {
		propPos = pos;
	}
	void setLiveState(bool liveState) {
		live = liveState;
	}
	bool getLiveState()const {
		return live;
	}
	PropType getPropType() const {
		return type;
	}
	cocos2d::Vec2 getPropInitPos() const {
		return propPos;
	}
	cocos2d::Rect getPropRect();//返回自己的Rect
private:
	int speed;
	int blinkCount;
	bool live;
	PropType type;
	cocos2d::Node* root;
	cocos2d::Sprite* propSp;
	cocos2d::SpriteFrameCache* gameSpriteCache;
	cocos2d::Vec2 propPos;
	cocos2d::Size propSize;
	cocos2d::Size size;
};
#endif // !_PROP_H_



